package com.lex.util;

import org.springframework.stereotype.Component;

@Component
public class MyContext {
    private static final ThreadLocal<String> CURRENT_USER_NAME = new ThreadLocal<>();
    public static void clear() {
        CURRENT_USER_NAME.remove();
    }
    public static void setCurrentUserName(String userName) {
        CURRENT_USER_NAME.set(userName);
    }
    public static String getCurrentUserName() {
        return CURRENT_USER_NAME.get();
    }
    public static void clearUserName() {
        CURRENT_USER_NAME.remove();
    }
}